package com.hengpeng.msls.domain;

import com.hengpeng.common.util.MD5;

public class Token
{
	private long expireTime;

	private String password;

	private String signature;

	private long time;

	private String userName;

	public Token(String userName, String password, long time)
	{
		super();
		this.userName = userName;
		this.password = password;
		this.time = time;
		// 设置令牌1周+18小时有效，错开用户习惯每天固定时间登录导致令牌失效的问题
		this.expireTime = time + ((24 * 7 + 18) * 3600 * 1000);
		String content = userName + "#" + password + "#" + time + "#dhfapofhdofpodafjdao";
		this.signature = MD5.encodeString(content, "utf-8");
	}

	public long getExpireTime()
	{
		return expireTime;
	}

	public String getPassword()
	{
		return password;
	}

	public String getSignature()
	{
		return signature;
	}

	public long getTime()
	{
		return time;
	}

	public String getUserName()
	{
		return userName;
	}
}